﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geoprocessor;
using ESRI.ArcGIS.AnalysisTools;
using ESRI.ArcGIS.Carto;



namespace Akiha.Core
{
    public static class GeoprocessorWrapper
    {
        //public static bool GeoprocessingExportFcTCad(string In_features, string Out_name, cad_type type)
        //{
        //    bool isOK = false;
        //    try
        //    {
        //        // Create the geoprocessor. 
        //        Geoprocessor GP = new Geoprocessor();

        //        // Create the tool process object.
        //        ESRI.ArcGIS.ConversionTools.ExportCAD tool = new ESRI.ArcGIS.ConversionTools.ExportCAD();

        //        // Set parameter values.
        //        tool.in_features = In_features;
        //        tool.Output_Type = type.ToString();
        //        tool.Output_File = Out_name;
        //        // Execute the tool. 
        //        GP.Execute(tool, null);
        //        isOK = true;
        //        return isOK;
        //    }
        //    catch (Exception ex)
        //    {
        //        isOK = false;
        //        return isOK;
        //    }
        //}



        //public static void GPIntersect()
        //{
           
            
            
        //}


        ////获取shp文件的路径
        //public static string GetShapeFullPath(IFeatureClass pFeaCls)
        //{
        //    IDataset pDs = pFeaCls as IDataset;
        //    IWorkspace pWorkspace=pDs.Workspace;
        //    string strPathName= pWorkspace.PathName;
        //    string strName=pDs.BrowseName;
        //    return strPathName + @"\" + strName + ".shp";           
        //}


        //// 获取sde的全路径以使用gp服务
        ////首先要创建一个连接文件，连接文件可能不存在因此要先创建之后再连接
        ////
        //public static string GetSDESTR(IFeatureClass pFeaCls)
        //{
        //    IDataset pDs = pFeaCls as IDataset;
        //    IWorkspace pWorkspace = pDs.Workspace;
        //    string strPathName = pWorkspace.PathName;
        //    string strName = pDs.BrowseName;
        //    return strPathName + @"\" + strName;


        //    IPropertySetpProSet = newPropertySet();

        //    try
        //    {

        //        pProSet.SetProperty("Server", "EGOVA-Likun");

        //        pProSet.SetProperty("Instance", "5152");

        //        pProSet.SetProperty("Database", "cgdb");

        //        pProSet.SetProperty("user", "sde");

        //        pProSet.SetProperty("password", "sde");

        //        pProSet.SetProperty("version", "SDE.DEFAULT");

        //    }



        //    catch (Exception ex)
        //    {

        //        stringmsg = ex.Message;

        //    }

        //    string path = @"C:\test";

        //    string sdeName = @"test.sde";

        //    string sdePath = path + "\\" + sdeName;

        //    if (File.Exists(sdePath))
        //    {

        //        File.Delete(sdePath);

        //    }



        //    IWorkspaceFactory workspaceFactory = newSdeWorkspaceFactoryClass();

        //    IWorkspaceName workspaceName = workspaceFactory.Create(path, sdeName, pProSet, 0);



        //}

    }
}
